package goods;

import java.io.*;
import java.util.ArrayList;

public class GoodsDataWrite {
    public boolean DataWrite(GoodsDataRead GDR) {
        GoodsDAOArrayList goodsInterface =  GDR.getGoodsData();
        ArrayList<Goods> goodsArrayList = goodsInterface.getGoodsArrayList();
        BufferedWriter out;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("商品数据.txt"),"utf-8"));
            for (Goods G:goodsArrayList) {
                out.write(G.toString());
            }
            out.close();
        } catch (IOException e){
            e.printStackTrace();
        }


        return true;
    }

}
